12. Errors and Exceptions
SOLUTION:
- Any syntax error can be detected before running your program.
- An exception occurs during run time.
- There are many types of exceptions.
QUIZ QUESTION::
Here are some of the common exceptions programmers run into in Python. Do some research online to match the appropriate description for each.
ANSWER CHOICES:
Built-in Exception |
Description |
---|---|
An object of an unsupported type is passed as input to an operation or function. |
|
A sequence subscript is out of range. |
|
An object of the correct type but inappropriate value is passed as input to a built-in operation or function. |
|
A key can't be found in a dictionary. |
|
An assert statement fails. |
SOLUTION:
Built-in Exception |
Description |
---|---|
An object of an unsupported type is passed as input to an operation or function. |
|
A sequence subscript is out of range. |
|
An object of the correct type but inappropriate value is passed as input to a built-in operation or function. |
|
A key can't be found in a dictionary. |
|
An assert statement fails. |